import { defineStore } from 'pinia';

import { StoreEnum } from '../enum';

export const useUserData = defineStore(StoreEnum.USER_STORE, {
  persist: true, // 持久化存储
  state: (): UserState => ({}),
  actions: {
    setState<K extends keyof UserState>(playload: Record<K, UserState[K]>) {
      this.$patch({ ...playload });
    },
  },
});
